#{extends 'mainStage.html' /}
#{set title:'Demandes d\'annulation'/}

    <div class="post">
        <h2 class="post-title">
			#{if candidatures.size != 0}
            	Liste des candidatures en attente de validation d'annulation
        </h2>
        <br>
			#{form @validationAnnulation()}

			<table width="200" cellspacing='0' cellpadding='7' id="liste" class="display" summary="Liste des candidats" bgcolor="#E1EEF0">
				<thead>
					<tr>
					    <th>Stage</th>
					    <th>Code</th>
						<th>Nom</th>
						<th>Pr&eacute;nom</th>
						<th>Statut</th>
						<th>CIS ou Service</th>
					 	<th>Structure de coordination</th> 
					 	<th>Raison de l'annulation</th>
						<th>Annuler la candidature ?</th>
					</tr>
				</thead>
		        #{list items:candidatures, as:'candidature' }				
    		       	<tr>
    		       	    <td>
    		       	    #{if candidature.stage!=null}
    		       	    ${candidature.stage.intitule}
    		       	    #{/if}
    		       	    #{else}
    		       	    Stage non planifié
    		       	    #{/else}
    		       	    </td>
    		       	    <td>
    		       	    #{if candidature.stage!=null}
    		       	    ${candidature.stage.code}
    		       	     #{/if}
    		       	    #{else}
    		       	    Stage non planifié
    		       	    #{/else}
    		       	    </td>
    		           	<td><a href="@{candidats.detailCandid(candidature.id)}">${candidature.agent.nom}</a></td>
       		           	<td>${candidature.agent.prenom}</td>
    				   	<td>${candidature.agent.statut}</td>
    				   	<td>${candidature.agent.cisService} </td>
    				   	<td>${candidature.agent.cis.groupement}</td>
    				   	<td>${candidature.motifAnnulation}</td>
    				   	<td>
    				   	        <input type="radio" name="${candidature.id}" id="O${candidature.id}" value="oui" onmousedown="this.__chk = this.checked" onclick="if (this.__chk) this.checked = false; testBox('${candidature.id}')"> Oui
        				   	    <input type="radio" name="${candidature.id}" id="N${candidature.id}" value="non" onmousedown="this.__chk = this.checked" onclick="if (this.__chk) this.checked = false; testBox('${candidature.id}')"> Non
    				   	</td>
    		       	</tr>  
		        #{/list}
			</table>
			<br />
			<input type="submit" value="Valider" style="float:right;"/>
			<input type="hidden" value="${id}" name="id" />
		#{/form}
		#{/if}
		#{else}
			Aucune candidatures en attente de validation d'annulation
		#{/else}
    </div>
	<script TYPE="text/javascript">
	function testBox(id){
		if(document.getElementById("N"+id).checked){
			document.getElementById("R"+id).disabled=false;
		}
		else{
			document.getElementById("R"+id).disabled=true;
			document.getElementById("R"+id).value="";
		}
	}
	</script>